import { Toast } from "vant";
export default {
  components: {},
  props: {},
  data() {
    return {
      username: "",
      cardno: "",
      type: 1,
      orderId: ''
    };
  },
  activated() {
    console.log(this.$route.params,'reallllllll');
    this.type = this.$route.params.type;
    this.orderId = this.$route.params.orderId;
  },

  methods: {
    // 实名认证
    submit() {
      
      if (this.username == "") {
        Toast("请输入姓名");
        return;
      }
      if (this.cardno == "") {
        Toast("请输入身份证号");
        return;
      }
      var that = this;
      
      $http.post("TuWenhua.shiming", { 
        name: this.username, 
        idcard: this.cardno,
        uid: localStorage.getItem("uid") ? localStorage.getItem("uid") : localStorage.getItem("mid")
      }).then(res => {
        console.log(res,'实名认证');
        if (res.result == 0) {
          return this.$toast(res.msg);
        }
        this.$toast('认证成功');
        if(that.type == 1) {
          this.$router.push(this.fun.getUrl("home"));
        }else {
          this.$router.push(this.fun.getUrl("uploadAuthorization", { id: that.orderId }));
        }
        
      });
     
    }
  }
};
